package com.goldman.aplt.mq.producer;

import com.goldman.message.common.event.MessageModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.integration.support.MessageBuilder;

@EnableBinding(MkMessageSource.class)
public class MkMessagePublisher {
    private static final Logger logger = LoggerFactory.getLogger(MkMessagePublisher.class);

    @Autowired
    private MkMessageSource source;

    public boolean publish(MessageModel<String> messageModel) {
        boolean send = source.output().send(MessageBuilder.withPayload(messageModel)
                .build());
        return send;
    }
}
